package com.tjshop.android.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.tjshop.android.R;

public class FragmentCity extends Fragment {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	// 初始化标题栏
	void initTitleBar(View container) {
		TextView title = (TextView) container
				.findViewById(R.id.common_title_bar_text);
		title.setText("当前城市");

		ImageView rightIcon = (ImageView) container
				.findViewById(R.id.common_title_bar_right_icon);
		rightIcon.setImageResource(R.drawable.title_bar_search);

		container.findViewById(R.id.common_title_bar_left_icon).setVisibility(
				View.GONE);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View v = LayoutInflater.from(getActivity()).inflate(
				R.layout.activity_main_fragment_catagory, null);

		initTitleBar(v);

		return v;
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
	}

	@Override
	public void onPause() {
		super.onPause();

		boolean userVisibleHint = getUserVisibleHint();
		Log.w(FragmentCity.class.getSimpleName(), "onPause - userVisibleHint: "
				+ userVisibleHint);
	}

	@Override
	public void onResume() {
		super.onResume();

		boolean userVisibleHint = getUserVisibleHint();
		Log.w(FragmentCity.class.getSimpleName(),
				"onResume - userVisibleHint: " + userVisibleHint);
	}

}
